package itdep.domain.address;

import itdep.domain.NamedEntity;

import javax.persistence.*;
import java.util.HashSet;
import java.util.Set;

/**
 * @author Ivan Khalopik
 * @version $Revision: 47 $ $Date: 2010-07-05 09:28:44 +0000 (Mon, 05 Jul 2010) $
 */
@Entity
@Table(name = "DISTRICT")
public class District extends NamedEntity {
	public static final String REGION_PROPERTY = "region";

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "ID_REGION", nullable = false)
	private Region region;

	@OneToMany(mappedBy = "district")
	private Set<City> cities = new HashSet<City>();

	public Set<City> getCities() {
		return cities;
	}

	public void setCities(Set<City> cities) {
		this.cities = cities;
	}

	public Region getRegion() {
		return region;
	}

	public void setRegion(Region region) {
		this.region = region;
	}
}